package com.ktjy.mapper.impl;


import com.ktjy.entity.Auction;
import com.ktjy.entity.AuctionVo;
import com.ktjy.mapper.AuctionMapper;
import com.ktjy.util.MybatisUtil;
import org.apache.ibatis.session.SqlSession;

import java.util.HashMap;
import java.util.List;

public class AuctionMapperImpl implements AuctionMapper {
    @Override
    public int insert(Auction auction) {
        SqlSession session= MybatisUtil.createSession();
        int result=session.getMapper(AuctionMapper.class).insert(auction);
        session.commit();//提交事务
        return result;
    }

    @Override
    public int update(Auction auction) {
        return MybatisUtil.createSession().getMapper(AuctionMapper.class).update(auction);
    }

    @Override
    public int countAuction(HashMap<String, Object> hashMap) {
        return MybatisUtil.createSession().getMapper(AuctionMapper.class).countAuction(hashMap);
    }

    @Override
    public List<Auction> getAuctionByPage(HashMap<String, Object> hashMap) {
        return MybatisUtil.createSession().getMapper(AuctionMapper.class).getAuctionByPage(hashMap);
    }

    @Override
    public List<AuctionVo> getEndAcution(Integer userId) {
        return MybatisUtil.createSession().getMapper(AuctionMapper.class).getEndAcution(userId);
    }

    @Override
    public List<Auction> getAuctioning() {
        return MybatisUtil.createSession().getMapper(AuctionMapper.class).getAuctioning();
    }
}
